Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(core): Improve offline transport test performance #13460

Closed

Conversation

Lms24
Copy link
Member

@Lms24 Lms24 commented Aug 26, 2024

extracted from #13439

based on #13458

This PR significantly improves the performance of our offline transport unit tests. These tests were the bottleneck of our unit test performance previously, as they included actual multi-second timeouts. This PR converts the test to use vitest's fake timers which as far as I can tell, still tests the offline transport correctly but heavily increases performance.

Locally, I this brought down the runtime of the entire test suite from ~20s to ~6s.

@Lms24 Lms24 changed the base branch from develop to lms/test-core-vitest August 26, 2024 12:00
@@ -411,7 +416,7 @@ describe('makeOfflineTransport', () => {
START_DELAY + 2_000,
);

it.skip(
it(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We previously skipped this test because it was flaky. I'm gonna un-skip it for now. Maybe using fake timers and or vitest helps. If we notice it being flaky, we should fix the test this time

@Lms24
Copy link
Member Author

Lms24 commented Aug 26, 2024

@timfish would you mind giving this PR a quick review - I think you wrote the tests initially, right?

@Lms24
Copy link
Member Author

Lms24 commented Aug 30, 2024

Argh I tried converting this to jest after giving up on switching to vitest (#13458). Turns out jest fake timers work differently and I couldn't get the tests passing after making the switch. I don't have the time to revisit so I'm gonna close this for now.

@Lms24 Lms24 closed this Aug 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants